class_name PlayerJumpState
extends PlayerState

const AIR_SPEED: float = 60
const JUMP_FORCE: float = 20

func enter() -> void:
	super()
	player.velocity.y = JUMP_FORCE
	player.animation_player.play("jump", -1, 2)

func exit(new_state: State = null) -> void:
	super(new_state)
	player.velocity.x = 0

func process_input(event: InputEvent) -> State:
	super(event)
	if event.is_action_released("jump"):
		player.velocity.y = 0
	return null

func process_physics(delta: float) -> State:
	do_move(get_move_dir(), AIR_SPEED)
	if player.velocity.y < 0:
		return fall_state
	return super(delta)
